Embodiments of the present invention relate to a method, apparatus and computer program product for adding instrumentation to a body of code to enable generation of code coverage data.
In IT systems engineering, testing is normally conducted on a software system being built. Part of the testing procedure may involve establishing code coverage data for the performed testing. Code coverage tools commonly rely on upfront modification to the code, or on-the-fly instrumentation of the code. Such procedures insert additional instructions in the code to detect when code sections such as statements, blocks, functions or methods, have been processed or executed. This approach can be computationally costly as additional code paths are inserted and additional input and output (IO) operations are required to log the collected coverage data for subsequent analysis.
The process of adding instrumentation to a body of code to gather metrics is commonly a one-off operation or performed relatively infrequently. Nevertheless, such instrumentation is a time consuming and thus costly process. Furthermore, the added instrumentation code affects the running of the program code itself because code processing timings are changed and performance impacted by the additional processing.